package com.zpark.controller;

import com.zpark.entity.Product;
import com.zpark.service.ISearchService;
import com.zpark.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("search")
public class SearchController extends BaseController{

    @Autowired
    private ISearchService searchService;

    @RequestMapping("product_list/{title}")
    public JsonResult<List<Product>> findByProductName(@PathVariable("title") String title){
        List<Product> data = searchService.SearchBytitle(title);
        return new JsonResult<List<Product>>(OK, data);
    }

}
